{extends file="../global.html"}
{block name=body}



 

      
          <div class="content" >
            <!-- 右侧内容框架，更改从这里开始 -->
            <form class="layui-form xbs" action="{url('/run/type/index')}" method="get">
                <div class="layui-form-pane" style="text-align: center;">
                  <div class="layui-form-item" style="display: inline-block;">
                    <!-- <label class="layui-form-label xbs768">日期范围</label>
                    <div class="layui-input-inline xbs768">
                      <input class="layui-input" placeholder="开始日" id="LAY_demorange_s">
                    </div>
                    <div class="layui-input-inline xbs768">
                      <input class="layui-input" placeholder="截止日" id="LAY_demorange_e">
                    </div> -->
                    <div class="layui-input-inline">
                      <input type="text" name="type_name"  placeholder="请输入分类名" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-input-inline" style="width:80px">
                        <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                    </div>
                  </div>
                </div> 
            </form>
            <xblock><button class="layui-btn" onclick="window.location.href='add'"><i class="layui-icon">&#xe608;</i>添加</button><span class="x-right" style="line-height:40px">共有数据：{$num} 条</span></xblock>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th>
                            <input type="checkbox" name="" value="">
                        </th>
                        <th>
                            ID
                        </th>
                        <th>
                           品牌名
                        </th>
                        <th>
                            品牌图片
                        </th>
                        <th>
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody>
                {foreach $res as $v}
                    <tr class="del_{$v.type_id}">
                        <td>
                            <input type="checkbox" value="1" name="">
                        </td>
                        <td>
                           {$v.type_id}
                        </td>
                        <td>
                            <u style="cursor:pointer" >
                                 {$v.type_name}
                            </u>
                        </td>
                        
                       
                        <td>
                            <img src="{$absroot}{$v.type_pic}" alt="" width="50">
                        </td>
                    
                        <td class="td-manage">
                            
                            <a title="编辑" href="{url('/run/Type/edit/type_id/'|cat:$v.type_id)}"
                            class="ml-5" style="text-decoration:none">
                                <i class="layui-icon">&#xe642;</i>
                            </a>
                         
                            <a title="删除" href="javascript:typeDel({$v.type_id})" 
                            style="text-decoration:none">
                                <i class="layui-icon">&#xe640;</i>
                            </a>
                        </td>
                    </tr>
                   {/foreach}
                </tbody>
                

            </table>
            <!-- 右侧内容框架，更改从这里结束 -->

<div align="center">
    {$res->render()}
</div>
          </div>

          <script type="text/javascript">
          function typeDel(typid){
            if(confirm('确定要删除？')==true){
               
                // alert(typid);
               // var a =  $('.del_'+typid);
               //  alert(a);
               $.ajax({
                type:"post",
                data:{ type_id:typid},
                url:"{url('run/type/ajaxDel')}",
                success:function(msg){
                // alert(msg);
                    if(msg==true){
                      var tr = $('.del_'+typid);
                         $('.del_'+typid).remove();        
                    }
                    else{
                        alert('删除失败');
                    }
             },
             error:function(XMLHttpRequest, textStatus, errorThrown){
                     // alert(XMLHttpRequest.status);  
                     //   alert(XMLHttpRequest.readyState);  
                     //   alert(textStatus);  
                

            }

             })
            }
          }
          
          

          </script>
        
{/block}
